package com.saihai.jiankang.ufLmfw.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.saihai.common.annotation.Log;
import com.saihai.common.core.controller.BaseController;
import com.saihai.common.core.domain.AjaxResult;
import com.saihai.common.enums.BusinessType;
import com.saihai.jiankang.ufLmfw.domain.UfLmfw;
import com.saihai.jiankang.ufLmfw.service.IUfLmfwService;
import com.saihai.common.utils.poi.ExcelUtil;
import com.saihai.common.core.page.TableDataInfo;

/**
 * 体检范围参数Controller
 * 
 * @author ruoyi
 * @date 2024-07-16
 */
@RestController
@RequestMapping("/jiankang/ufLmfw")
public class UfLmfwController extends BaseController
{
    @Autowired
    private IUfLmfwService ufLmfwService;

    /**
     * 查询体检范围参数列表
     */
    @GetMapping("/list")
    public TableDataInfo list(UfLmfw ufLmfw)
    {
        startPage();
        List<UfLmfw> list = ufLmfwService.selectUfLmfwList(ufLmfw);
        return getDataTable(list);
    }

    /**
     * 导出体检范围参数列表
     */
    @Log(title = "体检范围参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, UfLmfw ufLmfw)
    {
        List<UfLmfw> list = ufLmfwService.selectUfLmfwList(ufLmfw);
        ExcelUtil<UfLmfw> util = new ExcelUtil<UfLmfw>(UfLmfw.class);
        util.exportExcel(response, list, "体检范围参数数据");
    }

    /**
     * 获取体检范围参数详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ufLmfwService.selectUfLmfwById(id));
    }

    /**
     * 新增体检范围参数
     */
    @Log(title = "体检范围参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UfLmfw ufLmfw)
    {
        return toAjax(ufLmfwService.insertUfLmfw(ufLmfw));
    }

    /**
     * 修改体检范围参数
     */
    @Log(title = "体检范围参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UfLmfw ufLmfw)
    {
        return toAjax(ufLmfwService.updateUfLmfw(ufLmfw));
    }

    /**
     * 删除体检范围参数
     */
    @Log(title = "体检范围参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ufLmfwService.deleteUfLmfwByIds(ids));
    }
}
